#pragma once
#include <stdint.h>

#define    REQUEST_GET_SALT         1
#define    REQUEST_REGISTER         2
#define    REQUEST_LOGIN            3
#define    REQUEST_DEREGISTER       4
#define    REQUEST_CD               10
#define    REQUEST_PWD              11
#define    REQUEST_LS               12
#define    REQUEST_MKDIR            13
#define    REQUEST_RMDIR            14
#define    REQUEST_REMOVE           15
#define    REQUEST_PUTS             21
#define    REQUEST_FILE_PUTS_RESULT 22
#define    REQUEST_GETS             25
#define    REQUEST_EXIT             88
#define    RESPONSE                 100

#define    RESPONSE_OK                  100
#define    RESPONSE_ERROR_REQUEST       200
#define    RESPONSE_INVALID_REQUEST     201
#define    RESPONSE_USERNAME_NOT_EXIST  210
#define    RESPONSE_USERNAME_IS_EXIST   211
#define    RESPONSE_PASSWORD_WRONG      220
#define    RESPONSE_INVALID_TOKEN       230
#define    RESPONSE_TOKEN_EXPIRED       231
#define    RESPONSE_FILE_EXIST          300
#define    RESPONSE_FILE_NOT_EXIST      301


#define TLV_BUFFER_MAX_SIZE 4096
#define TLV_VALUE_MAX_SIZE (TLV_BUFFER_MAX_SIZE-sizeof(uint32_t)-sizeof(uint32_t))

int tlv_listen(int sockfd,uint32_t *type,uint32_t *length,uint8_t *value);
int tlv_response(int sockfd,uint32_t response_code,uint32_t length,const uint8_t *value);
